<template>
  <div class="m-select">
    <el-date-picker
      v-model="monthPoint"
      type="month"
      placeholder="选择月"
      @change="getMonthPonit">
    </el-date-picker>
    <el-date-picker
      v-model="monthPeriod"
      type="monthrange"
      range-separator="至"
      start-placeholder="开始月份"
      end-placeholder="结束月份"
      @change="getMonthPeriod">
    </el-date-picker>
  </div>
</template>
 
<script>
export default {
  name: 'mSelect',
  data () {
    return {
      monthPoint: '',
      monthPeriod: [],
    }
  },
  props: {
    initMonthPoint: String,
    initMonthPeriod: {
      type: Array,
      default() {
        return []
      }
    }
  },
  mounted() {
    this.monthPoint = this.initMonthPoint
    this.monthPeriod = this.initMonthPeriod
  },
  methods: {
    getMonthPonit(v) {
      this.$emit('getMonthPonit', v)
    },
    getMonthPeriod(v) {
      this.$emit('getMonthPeriod', v)
    }
  }
}
</script>
 
<style scoped lang="scss">
 
</style>